package com.tulingxueyuan.stock;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 功能描述
 *
 * @author fujc-dev@qq.com
 * @date: 2023年10月19日 18:29
 */
@Configuration
public class MyConfig {

    //@Bean(name = "notebookPC")
    public Computer computer1() {
        return new Computer("笔记本电脑");
    }

    //    @ConditionalOnBean(Computer.class)
    @ConditionalOnMissingBean(Computer.class)
    @Bean("notebookPC")
    public Computer computer2() {
        return new Computer("备用电脑");
    }
}
